
router {
    mode: {{ qdrouterd_mode }}
    id: {{ ansible_hostname }}
    workerThreads: {{ qdrouterd_worker_threads }}
    saslConfigPath: {{ qdrouterd_sasl_conf_path }}
    saslConfigName: {{ qdrouterd_service_name }}
}

sslProfile {
    name: {{ ansible_hostname }}
{% if qdrouterd_ssl_ca_cert is defined %}
    certDb: {{ qdrouterd_ssl_ca_cert }}
{% endif %}
    certFile: {{ qdrouterd_ssl_cert }}
    keyFile: {{ qdrouterd_ssl_key }}
}

listener {
    host: {{ qdrouterd_listener_addr }}
    port: {{ qdrouterd_listener_port_ssl }}
    role: normal
    sslProfile: {{ ansible_hostname }}
    authenticatePeer: {{ qdrouterd_listener_auth_peer }}
    saslMechanisms: {{ qdrouterd_listener_sasl_mech }}
}

listener {
    host: {{ qdrouterd_listener_addr }}
    port: {{ qdrouterd_listener_port_plain }}
    role: normal
    authenticatePeer: {{ qdrouterd_listener_auth_peer }}
    saslMechanisms: {{ qdrouterd_listener_sasl_mech }}
}

{% if qdrouterd_host_count > '1' %}
listener {
    host: {{ qdrouterd_irl_addr }}
    port: {{ qdrouterd_irl_port_ssl }}
    role: inter-router
    sslProfile: {{ ansible_hostname }}
    authenticatePeer: {{ qdrouterd_irl_auth_peer }}
    saslMechanisms: {{ qdrouterd_irl_sasl_mech }}
}

listener {
    host: {{ qdrouterd_irl_addr }}
    port: {{ qdrouterd_irl_port_plain }}
    role: inter-router
    authenticatePeer: {{ qdrouterd_irl_auth_peer }}
    saslMechanisms: {{ qdrouterd_irl_sasl_mech }}
}
{% endif %}

{% for router in groups['qdrouterd_all'] %}
{% if inventory_hostname < router %}
connector {
    host: {{ hostvars[router]['ansible_eth0']['ipv4']['address'] }}
    role: inter-router
    port: {{ qdrouterd_irl_port_plain }}
}
{% endif %}
{% endfor %}

address {
    prefix: unicast
    distribution: closest
}
address {
    prefix: exclusive
    distribution: closest
}
address {
    prefix: broadcast
    distribution: multicast
}
address {
    prefix: openstack.org/om/rpc/multicast
    distribution: multicast
}
address {
    prefix: openstack.org/om/rpc/unicast
    distribution: closest
}
address {
    prefix: openstack.org/om/rpc/anycast
    distribution: balanced
}
address {
    prefix: openstack.org/om/notify/multicast
    distribution: multicast
}
address {
    prefix: openstack.org/om/notify/unicast
    distribution: closest
}
address {
    prefix: openstack.org/om/notify/anycast
    distribution: balanced
}

log {
    module: {{ qdrouterd_log_module }}
    enable: {{ qdrouterd_log_enable }}
    timestamp: true
    output: {{ qdrouterd_log_file }}
}
